<?php

App::uses('AppModel', 'Model');

/**
 * Administrator Model
 *
 */
class Administrator extends AppModel {
	
	
	/**
	 * Display field
	 * @var string
	 */
	public $displayField = 'name';
	
	/**
	 * Validation rules
	 *
	 * @var array
	 */
	public $validate = array(
		'email' => array(
			'email' => array(
				'rule' => array('email'),
				//'message' => 'Your custom message here',
				//'allowEmpty' => false,
				//'required' => false,
				//'last' => false, // Stop validation after this rule
				//'on' => 'create', // Limit validation to 'create' or 'update' operations
			),
		)
	);
	
	
	public function beforeSave($options = array()) {
		
        $this->data[$this->name]['password'] = AuthComponent::password($this->data[$this->name]['password']);
		
        return true;
		
    }
	
	
}
